

//package com.atzly.community.config;
//
//import org.elasticsearch.client.RestHighLevelClient;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.elasticsearch.client.ClientConfiguration;
//import org.springframework.data.elasticsearch.client.RestClients;
//
///**
// *  向容器中添加es启动核心关键类
// * @author zlysimida
// * @date 2021/9/1 - 19:12
// */
//@Configuration
//public class ESconfig {
//
//    @Bean
//    public RestHighLevelClient restHighLevelClient(){
//        ClientConfiguration configuration = ClientConfiguration.builder()
//                .connectedTo("localhost:9200")
//                //.withConnectTimeout(Duration.ofSeconds(5))
//                //.withSocketTimeout(Duration.ofSeconds(3))
//                //.useSsl()
//                //.withDefaultHeaders(defaultHeaders)
//                //.withBasicAuth(username, password)
//                // ... other options
//                .build();
//        RestHighLevelClient client = RestClients.create(configuration).rest();
//        return client;
////        return new RestHighLevelClient(
////                RestClient.builder(
////                        new HttpHost("localhost",9200,"http"))
////                        .setRequestConfigCallback(requestConfigBuilder -> {
////                            return requestConfigBuilder.setConnectTimeout(5000 * 1000) // 连接超时（默认为1秒）
////                                    .setSocketTimeout(6000 * 1000);// 套接字超时（默认为30秒）//更改客户端的超时限制默认30秒现在改为100*1000分钟
////                        }));// 调整最大重试超时时间（默认为30秒）.setMaxRetryTimeoutMillis(60000);
//    }


//}
